/*
	Penjin is Copyright (c)2005, 2006, 2007, 2008, 2009, 2010 Kevin Winfield-Pantoja

	This file is part of Penjin.

	Penjin is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Penjin is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Penjin.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SPHERE_H
#define SPHERE_H
#include "PenjinTypes.h"
#include "Colour.h"
#include <vector>

class Sphere
{
    public:
        Sphere();
        ~Sphere();

        void setRadius(CRfloat r);
        void setSegmentsH(CRuint s);
        void setSegmentsV(CRuint s);

        template <class T>
        void setPosition(const T& p){position.x = p.x;position.y=p.y;position.z=p.z;}
        void setColour(const Colour& c){colour = c;}
        void setAlpha(CRfloat a){colour.alpha = a;}

        void render();

    private:
        void refresh(); //  recalc vertices if something changed
        uint Hsegs;
        uint Vsegs;
        float radius;
        vector<float> verts;
        vector<float> norms;
        Colour colour;
        Vector3df position;
};

#endif // SPHERE_H
